# -*- coding: utf-8 -*-
from django.urls import path
from rest_framework.routers import DefaultRouter
from studentweb.views import FacultyViewSet,MajorViewSet,StudentViewSet
from studentweb import views

# 1.实例一个 DefaultRouter
router = DefaultRouter()

# 2.注册相应的url
# 注册faculty对象
router.register('facultys', FacultyViewSet, basename='facultys')  # http://127.0.0.1:8000/api/v1/facultys/
# 注册major对象
router.register('majors', MajorViewSet, basename='majors')  # http://127.0.0.1:8000/api/v1/majors/
# 注册student对象
router.register('students', StudentViewSet, basename='students')  # http://127.0.0.1:8000/api/v1/students/

urlpatterns = [
    path("students/",views.get_students), # 获取所有学生信息的接口
    path("student/add/",views.add_student), # 添加学生信息的接口
    path('sno/check/', views.is_exists_sno), # 校验学号是否存在
    path('student/add/', views.add_student), # 添加学生信息的接口
    path('student/update/', views.update_student),  # 修改学生信息的接口
    path('student/delete/', views.delete_student),  # 删除学生信息的接口
    path('students/delete/', views.delete_students),  # 删除学生信息的接口
    path("upload/",views.upload), # 上传接口
    path("excel/import/",views.import_student_excel), # 导入excel文件
    path("excel/export/",views.export_student_excel), # 导出excel文件
]

urlpatterns += router.urls